﻿@{
	ViewBag.Title = Resources.SysUserMaster + ConstValues.strDash + Resources.HuiTongCIS;
}
<div id="menuBar" style="height:35px;">
	<div style="float: left; padding: 5px 5px; font-weight: bold; text-align: left;">
		@Resources.UserName/@Resources.FullName/@Resources.Mail：<input id="selUserName" class="easyui-textbox" style="height:27px; width:200px;" />&nbsp;&nbsp;
		@Resources.Status：<select id="selStatus" class="easyui-combobox" style="height:27px; width:200px;" data-options="editable:false,panelHeight:'auto'">
			<option value="">@Resources.All</option>
			<option value="@ConstValues.Status.正常">@Resources.Normal</option>
			<option value="@ConstValues.Status.暂停">@Resources.Pause</option>
		</select>&nbsp;&nbsp;
		@Resources.IsLocked：<select id="selLock" class="easyui-combobox" style="height:27px; width:200px;" data-options="editable:false,panelHeight:'auto'">
			<option value="">@Resources.All</option>
			<option value="@ConstValues.IsLock.是">@Resources.Yes</option>
			<option value="@ConstValues.IsLock.否">@Resources.No</option>
		</select>&nbsp;&nbsp;
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-search" onclick="searchData();">@Resources.Search</a>&nbsp;&nbsp;
		@if ((User as ICISPrincipal).IsSSA || Utility.HasSystemRole((User as ICISPrincipal), ConstValues.FunctionId.SysUserMaster, RoleType.添加))
		{
			<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-add" onclick="addData();" plain="true">@Resources.Create</a>
			<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-download" onclick="downloadImportTemplate();" plain="true">@Resources.TemplateDownLoad</a>
			<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-import" onclick="openImport();" plain="true">@Resources.Import</a>
		}
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-export" onclick="exportData();" plain="true">@Resources.Export</a>
	</div>
	<form id="frmExport" method="post" target="iframeDownload" action="@Url.Action(nameof(SysUserMasterController.Export))">
		@Html.AntiForgeryToken()
		<input type="hidden" id="hdnIds" name="AllId" />
	</form>
	<iframe id="iframeDownload" style="width:0; height:0; visibility:hidden" tabindex="-1"></iframe>
	<div class="clear"></div>
</div>
<div id="dataGrid"></div>

@section bodyParts {
<div id="detailWindow" class="easyui-window"
	title="@Resources.SysUserMaster" data-options="closed:true,minimizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<form id="frmDetail" method="post" enctype="multipart/form-data">
				@Html.AntiForgeryToken()
				<h3 class="tit01">@Resources.ConferenceUserMaster</h3>
				<table width="100%" height="100%" id="tblDetail" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.Status：</td>
						<td style="text-align: left;" class="w2 c2">
							<select id="ddlStatus" name="Status" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,panelHeight:'auto'">
								<option value="@ConstValues.Status.正常">@Resources.Normal</option>
								<option value="@ConstValues.Status.暂停">@Resources.Pause</option>
							</select>
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.IsLocked：</td>
						<td style="text-align: left;" class="w2 c2">
							<select id="ddlLock" name="Lock" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,panelHeight:'auto'">
								<option value="@ConstValues.IsLock.是">@Resources.Yes</option>
								<option value="@ConstValues.IsLock.否">@Resources.No</option>
							</select>
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.Sort：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtSort" name="Sort" class="easyui-textbox" style="height:27px; width:300px;">
						</td>
						<td style="text-align: right;" class="w1 c3"></td>
						<td style="text-align: left;" class="w2 c4"></td>
					</tr>
					<tr>
						<td style="text-align: right; " class="w1 c1">@Resources.Remark：</td>
						<td style="text-align: left;" class="w2 c2" colspan="3">
							<input id="txtRemark" name="Remark" class="easyui-textbox" style="height:50px; width:88%;" data-options="multiline:true, validType:['length[1,1000]']" />
						</td>
					</tr>
				</table>
				<h3 class="tit01">@Resources.UserInformation</h3>
				<table width="100%" height="100%" id="tblDetail" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.UserName：</td>
						<td style="text-align: left;" class="w2 c2">
							<input type="hidden" id="hidID" name="Id" />
							<input id="txtUserName" name="UserName" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']">
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.Mail：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtMail" name="Mail" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['email','length[1,100]'], required:true">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.Language：</td>
						<td style="text-align: left;" class="w2 c4">
							<select id="ddlLanguage" name="Language" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,panelHeight:'auto',required:true">
								<option value="@ConstValues.Language.Cn">@Resources.LanguageCN</option>
								<option value="@ConstValues.Language.En">@Resources.LanguageEN</option>
							</select>
						</td>
						<td style="text-align: right;" class="w1 c3"></td>
						<td style="text-align: left;" class="w2 c4"></td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.FullName：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtFullName" name="FullName" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.FullName（EN）：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtFullNameEN" name="FullNameEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.FamilyName：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtFamilyName" name="FamilyName" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']">
						</td>
						<td style="text-align: right;" class="w1 c3">@Resources.FamilyName（EN）：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtFamilyNameEN" name="FamilyNameEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.FirstName：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtFirstName" name="FirstName" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.FirstName（EN）：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtFirstNameEN" name="FirstNameEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.Gender：</td>
						<td style="text-align: left;" class="w2 c4">
							<select id="ddlGender" name="GenderStr" class="easyui-combobox" style="height:27px; width:300px;" data-options="required:true,panelHeight:'auto',editable:false">
								<option value="@ConstValues.Gender.男">@Resources.Male</option>
								<option value="@ConstValues.Gender.女">@Resources.Female</option>
							</select>
						</td>
						<td style="text-align: right;" class="w1 c3">@Resources.Birthday：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="dateBirthday" name="Birthday" class="easyui-datebox" style="height:27px; width:300px;" data-options="editable:false" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.Title：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="ddlCall" name="Call" class="easyui-combobox" style="height:27px; width:300px;" />
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.Title（EN）：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="ddlCallEN" name="CallEN" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.Degree：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="ddlDegree" name="Degree" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
						<td style="text-align: right;" class="w1 c3">@Resources.Career：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="ddlCareer" name="Career" class="easyui-combogrid" style="height:27px; width:300px;" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.OcisCodeField：</td>
						<td style="text-align: left;" class="w2 c2" colspan="3">
							<input id="ddlOcisCode" name="OcisCode" class="easyui-combogrid" style="height:27px; width:88%;" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.CV：</td>
						<td style="text-align: left;" class="w2 c4" colspan="3">
							<input id="txtCV" name="CV" class="easyui-textbox" style="height:50px; width:88%;" data-options="multiline:true, validType:['length[1,1000]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.CV（EN）：</td>
						<td style="text-align: left;" class="w2 c2" colspan="3">
							<input id="txtCVEN" name="CVEN" class="easyui-textbox" style="height:50px; width:88%;" data-options="multiline:true, validType:['length[1,1000]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.Affiliation：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtAffiliation" name="Affiliation" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
						</td>
						<td style="text-align: right;" class="w1 c3">@Resources.Affiliation（EN）：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtAffiliationEN" name="AffiliationEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.Department：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtDepartment" name="Department" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']">
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.Department（EN）：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtDepartmentEN" name="DepartmentEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.Address：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtAddress" name="Address" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,200]']" />
						</td>
						<td style="text-align: right;" class="w1 c3">@Resources.Address（EN）：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtAddressEN" name="AddressEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.ZipCode：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtZipCode" name="ZipCode" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.State：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtState" name="State" class="easyui-textbox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.Country：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="ddlCountry" name="Country" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
						<td style="text-align: right;" class="w1 c3">@Resources.City：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtCity" name="City" class="easyui-textbox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.Mobile：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtMobile" name="Mobile" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.Telephone：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtTelephone" name="Telephone" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.InvoiceTitle：</td>
						<td style="text-align: left;" class="w2 c4" colspan="3">
							<input id="txtInvoiceTitle" name="InvoiceTitle" class="easyui-combobox" style="height:27px; width:88%;" data-options="validType:['length[1,100]']">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.TaxNum：</td>
						<td style="text-align: left;" class="w2 c2" colspan="3">
							<input id="txtTaxNum" name="TaxNum" class="easyui-textbox" style="height:27px; width:88%;" data-options="validType:['length[1,100]']">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.AddressAndTel：</td>
						<td style="text-align: left;" class="w2 c4" colspan="3">
							<input id="txtAddressAndTel" name="AddressAndTel" class="easyui-textbox" style="height:27px; width:88%;" data-options="validType:['length[1,200]']">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.Bank：</td>
						<td style="text-align: left;" class="w2 c2" colspan="3">
							<input id="txtBank" name="Bank" class="easyui-textbox" style="height:27px; width:88%;" data-options="validType:['length[1,100]']">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.BankAccount：</td>
						<td style="text-align: left;" class="w2 c4" colspan="3">
							<input id="txtBankAccount" name="BankAccount" class="easyui-textbox" style="height:27px; width:88%;" data-options="validType:['length[1,100]']">
						</td>
					</tr>					
				</table>
			</form>
			<div class="btnDiv">
				<input type="hidden" id="hdnWindowType" />
				<input type="button" class="gbtn" onclick="saveData();" value="@Resources.Save" />&nbsp;&nbsp;
				<input type="button" class="rbtn" onclick="$('#detailWindow').window('close');" value="@Resources.Cancel" />
			</div>
		</div>
	</div>
</div>
<div id="actionWindow" class="easyui-window"
	title="@Resources.ModifyRole" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="actionWindowTitle" class="tit01">@Resources.ModifyRole</h3>
			<form id="actionDetail" method="post">
				@Html.AntiForgeryToken()
				<table width="100%" height="100%" id="actionTblDetail" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.UserName：</td>
						<td style="text-align: left;" class="w2 c2">
							<input type="hidden" id="hidUserId" name="userId"/>
							<input type="hidden" id="hidRoleID" name="hidRoleID" />
							<input id="tRoleName" class="easyui-textbox" style="height:27px; width:300px;" disabled />
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.RoleName：</td>
						<td style="text-align: left;" class="w2 c2">
							<select id="ddlAction" name="roleId" class="easyui-combobox" style="height:27px; width:220px;" data-options="editable:false,required:true"></select>
							&nbsp;&nbsp;<input type="button" class="gbtn" onclick="saveActionData();" value="@Resources.Create" />
						</td>
					</tr>
				</table>
			</form>
			<div id="actionGrid"></div>
		</div>
	</div>
</div>
<div id="groupWindow" class="easyui-window"
	title="@Resources.EditUserGroup" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="groupWindowTitle" class="tit01">@Resources.EditUserGroup</h3>
			<form id="groupDetail" method="post">
				@Html.AntiForgeryToken()
				<table width="100%" height="100%" id="groupTblDetail" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.UserName：</td>
						<td style="text-align: left;" class="w2 c2">
							<input type="hidden" id="groUserId" name="userIdGro" />
							<input type="hidden" id="hidGroupID" name="hidGroupID" />
							<input id="groRoleName" class="easyui-textbox" style="height:27px; width:300px;" disabled />
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.UserGroupName：</td>
						<td style="text-align: left;" class="w2 c2">
							<select id="ddlGroup" name="groupId" class="easyui-combobox" style="height:27px; width:220px;" data-options="editable:false,required:true"></select>
							&nbsp;&nbsp;<input type="button" class="gbtn" onclick="saveGroupData();" value="@Resources.Create" />
						</td>
					</tr>
				</table>
			</form>
			<div id="groupGrid"></div>
		</div>
	</div>
</div>
<div id="importWindow" class="easyui-window"
     title="@Resources.Import @Resources.LogsTypeUser" data-options="closed:true,minimizable:false,iconCls:'icon-save'"
     style="width:600px; display:none;">
	<div class="popupDiv">
		<form id="frmImport" method="post" enctype="multipart/form-data">
			@Html.AntiForgeryToken()
			<input id="importFile" name="ImportFile" class="easyui-filebox" style="height:27px; width:500px;" data-options="required:true, prompt:'@Resources.Import', buttonText:'@Resources.ChooseFile', accept:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'" />
		</form>
		<div class="buttonDiv">
			<input type="button" class="btn lbtn" onclick="importData();" value="@Resources.Import" />&nbsp;&nbsp;
			<input type="button" class="btn rbtn" onclick="$('#importWindow').window('close');" value="@Resources.Cancel" />
		</div>
	</div>
</div>
}

@section Scripts {
<script>
	common.setCurrentMenu("SysUserMaster");

	var windowWidth = $(window).width() - 285;
	var windowHeight = $(window).height() - 110;

	$(function () {
		$("#selUserName").textbox("textbox").bind("keydown", function (e) {
			if (e.keyCode == 13) {
				searchData()
			}
		});
		$("#dataGrid").datagrid({
			url: "@Url.Action(nameof(SysUserMasterController.GetData),
					nameof(SysUserMasterController).GetControllerName())",
			method: "get",
			//singleSelect: true,
			fitColumns: false,
			width: $(window).width() - 285,
			height: $(window).height() - 120,
			nowrap: false,
			pagination: true,
			pageSize: @ConstValues.DefaultGridRows,
			striped: true,
			toolbar: "#toolBar",
			pageSize: 100,
			pageList: [100, 200, 300, 400, 500],
			frozenColumns: [[
				{ field: "chk", align: "center", checkbox: true },
				{ field: "id", hidden: true },
				@if ((User as ICISPrincipal).IsSSA ||
					Utility.HasSystemRole((User as ICISPrincipal), ConstValues.FunctionId.SysUserMaster, RoleType.修改) ||
					Utility.HasSystemRole((User as ICISPrincipal), ConstValues.FunctionId.SysUserMaster, RoleType.删除))
				{
					<text>
					{
						field: "operate", title: "@Resources.Operate", align: "center", width: 320,
						formatter: function(value, rec) {
							var strInfo = "";
							var tmp = rec.userName.replace(new RegExp("'",'g'),"’").replace(new RegExp('"','g'),"“");
							@if ((User as ICISPrincipal).IsSSA || Utility.HasSystemRole((User as ICISPrincipal), ConstValues.FunctionId.SysUserMaster, RoleType.修改))
							{
								<text>
								strInfo += "<a href='#' style='color:#FF8C00;font-weight:bold;text-decoration:underline;' onclick='roleData(\""
										+ rec.id + "\",\"" + tmp + "\")'>@Resources.ModifyRole</a>";
								strInfo += "&nbsp;|&nbsp;";
								strInfo += "<a href='#' style='color:#1874CD;font-weight:bold;text-decoration:underline;' onclick='groupData(\""
									+ rec.id + "\",\"" + tmp + "\")'>@Resources.EditUserGroup</a>";
								strInfo += "&nbsp;|&nbsp;";
								strInfo += "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='editData(\""
									+ rec.id + "\")'>@Resources.Modify</a>";
								</text>
							}
							@if ((User as ICISPrincipal).IsSSA || Utility.HasSystemRole((User as ICISPrincipal), ConstValues.FunctionId.SysUserMaster, RoleType.删除))
							{
								<text>
								if (strInfo != "") {
									strInfo += "&nbsp;|&nbsp;";
								}
								strInfo += "<a href='#' style='color:#DC143C;font-weight:bold;text-decoration:underline;' onclick='deleteData(\""
									+ rec.id + "\",\"" + tmp + "\")'>@Resources.Delete</a>";
								return strInfo;
								</text>
							}
						}
					},
					</text>
				}
				{ field: "userName", title: "@Resources.UserName", align: "center", sortable: true, width: 150 }
			]],
			columns: [[
				{ field: "mail", title: "@Resources.Mail", align: "center", sortable: true, width: 250 },
				{ field: "familyName", title: "@Resources.FamilyName", align: "center", sortable: true, width: 150 },
				{ field: "firstName", title: "@Resources.FirstName", align: "center", sortable: true, width: 150 },
				{ field: "fullName", title: "@Resources.FullName", align: "center", sortable: true, width: 200 },
				{ field: "gender", title: "@Resources.Gender", align: "center", sortable: true, width: 150 },
				{ field: "birthday", title: "@Resources.Birthday", align: "center", sortable: true, width: 150 },
				{ field: "affiliation", title: "@Resources.Affiliation", align: "center", sortable: true, width: 300 },
				{ field: "call", title: "@Resources.Title", align: "center", sortable: true, width: 150 },
				{ field: "degree", title: "@Resources.Degree", align: "center", sortable: true, width: 150},
				{ field: "telephone", title: "@Resources.Telephone", align: "center", sortable: true, width: 150 },
				{ field: "mobile", title: "@Resources.Mobile", align: "center", sortable: true, width: 150 },
				{ field: "country", title: "@Resources.Country", align: "center", sortable: true, width: 150 },
				{ field: "state", title: "@Resources.State", align: "center", sortable: true, width: 150 },
				{ field: "city", title: "@Resources.City", align: "center", sortable: true, width: 150 },
				{ field: "address", title: "@Resources.Address", align: "center", sortable: true, width: 300 },
				{ field: "zipCode", title: "@Resources.ZipCode", align: "center", sortable: true, width: 150 },
				{
					field: "ocisCode", title: "@Resources.OcisCodeField", align: "center", sortable: true, width: 300,
					formatter: function (value, rec) {
						if (rec.ocisCodelist.length > 1) {
							return "<a href='javascript:void(0)' style='color:#DC143C;font-weight:bold;'  id='rowTp"+rec.id+"' >@Resources.MultiOcis</a>";
						} else {
							return value;
						}
					}
				},
				{ field: "department", title: "@Resources.Department", align: "center", sortable: true, width: 300 },
				{ field: "invoiceTitle", title: "@Resources.InvoiceTitle", align: "center",  sortable: true, width: 300 },
				{ field: "taxNum", title: "@Resources.TaxNum", align: "center",  sortable: true, width: 200 },
				{ field: "addressAndTel", title: "@Resources.AddressAndTel", align: "center",  sortable: true, width: 300 },
				{ field: "bank", title: "@Resources.Bank", align: "center",  sortable: true, width: 250 },
				{ field: "bankAccount", title: "@Resources.BankAccount", align: "center",  sortable: true, width: 200 },
				{ field: "passwordFailed", title: "@Resources.PasswordWrongCount", align: "center", sortable: true, width: 150 },
				{ field: "isLocked", title: "@Resources.IsLocked", align: "center", sortable: true, width: 150 },
				{ field: "status", title: "@Resources.Status", align: "center",  sortable: true, width: 150 },
				{ field: "sort", title: "@Resources.Sort", align: "center", sortable: true, width: 150 },
				{ field: "remark", title: "@Resources.Remark", align: "center",  sortable: true, width: 200 },
				{ field: "creator", title: "@Resources.Creator", align: "center", sortable: true, width: 150 },
				{ field: "createIP", title: "@Resources.CreateIP", align: "center", sortable: true, width: 150 },
				{ field: "createDate", title: "@Resources.CreateDate", align: "center", sortable: true, width: 150 }
			]],
			onBeforeLoad: function(param) {
				param.random = Math.random();
			},
			onLoadSuccess:function(data) {
				for (index = 0; index < data.rows.length; index++) {
					$("#rowTp"+data.rows[index].id).tooltip({
						position: "right",
						content: "<span style='color:#fff'>"+ data.rows[index].ocisCode+"</span>",
						onShow: function(){
							$(this).tooltip("tip").css({
								backgroundColor: "#666",
								borderColor: "#666"
							});
						}
					});
				}

				var exportIdList = $("#hdnIds").val();
				if (data.rows.length > 0) {
					var exportIdArray = exportIdList.split(',');
					for (var rowIndex = 0; rowIndex < data.rows.length; rowIndex++) {
						for (var index = 0; index < exportIdArray.length; index++) {
							if (data.rows[rowIndex].id == exportIdArray[index]) {
								$("input[type='checkbox']").eq(rowIndex + 1).prop("checked", true);
								break;
							}
						}
					}
				}
			},
			onCheck: function (rowIndex, rowData) {
				var exportIdList = $("#hdnIds").val();
				var strId = rowData.id.toString();
				if (exportIdList == "") {
					$("#hdnIds").val(strId);
				} else {
					var exportIdArray = exportIdList.split(',');
					var newArray = exportIdArray.concat(strId);
					$("#hdnIds").val(newArray.join());
				}
			},
			onUncheck: function (rowIndex, rowData) {
				var exportIdList = $("#hdnIds").val();
				var exportIdArray = exportIdList.split(',');
				var strId = rowData.id.toString();
				exportIdArray.remove(strId);
				$("#hdnIds").val(exportIdArray.join());
			},
			onCheckAll: function (rows) {
				var exportIdList = $("#hdnIds").val();
				if (exportIdList == "") {
					var newArray = new Array();
					for (var index = 0; index < rows.length; index++) {
						var strId = rows[index].id.toString();
						newArray = newArray.concat(strId);
					}
					$("#hdnIds").val(newArray.join());
				} else {
					var exportIdArray = exportIdList.split(',');
					var newArray = exportIdArray;
					for (var index = 0; index < rows.length; index++) {
						var strId = rows[index].id.toString();
						if (newArray.indexOf(strId) < 0) {
							newArray = newArray.concat(strId);
						}
					}
					$("#hdnIds").val(newArray.join());
				}
			},
			onUncheckAll: function (rows) {
				var exportIdList = $("#hdnIds").val();
				var exportIdArray = exportIdList.split(',');
				for (var index = 0; index < rows.length; index++) {
					var strId = rows[index].id.toString();
					exportIdArray.remove(strId);
				}
				$("#hdnIds").val(exportIdArray.join());
			},
		});

		$(window).resize(function () {
			$("#dataGrid").datagrid("resize", {
				width: $(window).width() - 285,
				height: $(window).height() - 110
			});
		});

		$("#detailWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);

				var orgCount = 0;
				var value = $("#txtInvoiceTitle").combobox("getText");
				$("#txtInvoiceTitle").combobox({
					url: "@Url.Action(nameof(UtilityController.GetInvoiceInfo), nameof(UtilityController).GetControllerName())",
					valueField: "invoiceTitle",
					textField: "invoiceTitle",
					panelHeight: "auto",
					hasDownArrow: false,
					onLoadSuccess: function(data) {
						orgCount = data.length;
						$(this).combobox("setText", value);
					},
					onChange: function (n,o) {
						$("#txtTaxNum").textbox("setValue", "");
						$("#txtAddressAndTel").textbox("setValue", "");
						$("#txtBank").textbox("setValue", "");
						$("#txtBankAccount").textbox("setValue", "");
					},
					onSelect: function (rec) {
						$("#txtTaxNum").textbox("setValue", rec.taxNum);
						$("#txtAddressAndTel").textbox("setValue", rec.addressAndTel);
						$("#txtBank").textbox("setValue", rec.bank);
						$("#txtBankAccount").textbox("setValue", rec.bankAccount);
					},
					onShowPanel: function () {
						if (orgCount < 10) {
							$(this).combobox("panel").height("auto");
						} else {
							$(this).combobox("panel").height(200);
						}
					},
					onHidePanel: function () { }
				});
			},
			width: $(window).width() - 285,
			height: $(window).height() - 110,
			left: ($(window).width() - windowWidth) * 0.5,
			top: ($(window).height() - windowHeight) * 0.5
		});

		$("#actionWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: ($(window).height() - 600) * 0.5
		});

		$("#groupWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: ($(window).height() - 600) * 0.5
		});

		$("#importWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: ($(window).height() - 600) * 0.5
		});
	});

	function searchData() {
		$("#dataGrid").datagrid("load", {
			SelUserName: $("#selUserName").textbox("getValue"),
			SelStatus: $("#selStatus").combobox("getValue"),
			SelLock: $("#selLock").combobox("getValue"),
		});
	}

	function deleteData(id, userName) {
		var confirmMessage = "@Resources.CfmDelete";
		confirmMessage = confirmMessage.replace(/\{0\}/g, userName);
		$.messager.confirm("@Resources.Delete", confirmMessage, function (r) {
			if (r) {
				$("#hidID").val(id);
				$.post("@Url.Action(nameof(SysUserMasterController.DeleteUser),
						nameof(SysUserMasterController).GetControllerName())",
					$("#frmDetail").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
							$("#dataGrid").datagrid("reload");
						}
					}
				);
			}
		});
	};

	function addData() {
		$("#hdnWindowType").val("add");
		$("#detailWindowTitle").text("@Resources.Create");
		$("#hidID").val("");
		$("#ddlLock").combobox("setValue", "@ConstValues.IsLock.否");
		$("#ddlStatus").combobox("setValue", "@ConstValues.Status.正常");
		$("#txtSort").textbox("setValue", "@ConstValues.DefaultSort");
		$("#txtRemark").textbox("setValue", "");

		$("#txtUserName").textbox("enable");
		$("#txtUserName").textbox("setValue", "");
		$("#txtMail").textbox("enable");
		$("#txtMail").textbox("setValue", "");
		$("#ddlLanguage").combobox("setValue", "");
		$("#txtFullName").textbox("setValue", "");
		$("#txtFullNameEN").textbox("setValue", "");
		$("#txtFamilyName").textbox("setValue", "");
		$("#txtFamilyNameEN").textbox("setValue", "");
		$("#txtFirstName").textbox("setValue", "");
		$("#txtFirstNameEN").textbox("setValue", "");
		$("#ddlGender").combobox("setValue", "");
		$("#dateBirthday").datebox("setValue", "");
		$("#ddlCall").combobox("setValue", "");
		$("#ddlCallEN").combobox("setValue", "");
		$("#ddlDegree").combobox("setValue", "");
		$("#ddlCareer").combogrid("setValue", "");
		$("#ddlOcisCode").combogrid("setValue", "");
		$("#txtCV").textbox("setValue", "");
		$("#txtCVEN").textbox("setValue", "");
		$("#txtAffiliation").textbox("setValue", "");
		$("#txtAffiliationEN").textbox("setValue", "");
		$("#txtDepartment").textbox("setValue", "");
		$("#txtDepartmentEN").textbox("setValue", "");
		$("#txtAddress").textbox("setValue", "");
		$("#txtAddressEN").textbox("setValue", "");
		$("#txtZipCode").textbox("setValue", "");
		$("#txtState").textbox("setValue","");
		$("#ddlCountry").combobox("setValue","");
		$("#txtCity").textbox("setValue","");
		$("#txtMobile").textbox("setValue", "");
		$("#txtTelephone").textbox("setValue", "");

		$("#txtInvoiceTitle").combobox("setValue", "");
		$("#txtTaxNum").textbox("setValue", "");
		$("#txtAddressAndTel").textbox("setValue", "");
		$("#txtBank").textbox("setValue", "");
		$("#txtBankAccount").textbox("setValue", "");

		$("#ddlCall").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCallEn), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: true,
			editable: false,
			panelHeight: "auto",
			onBeforeLoad: function (param) {
				param.language = "@ConstValues.Language.Cn";
			}
		});

		$("#ddlCallEN").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCallEn), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: true,
			editable: false,
			panelHeight: "auto",
			onBeforeLoad: function (param) {
				param.language = "@ConstValues.Language.En";
			}
		});

		$("#ddlDegree").combobox({
			url: "@Url.Action(nameof(UtilityController.GetDegree), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: true,
			editable: false,
			panelHeight: "auto",
		});

		$("#ddlCountry").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: true,
		});

		$("#ddlCareer").combogrid({
			url: "@Url.Action(nameof(UtilityController.GetCareer), nameof(UtilityController).GetControllerName())",
			panelWidth: (("@Request.Cookies["_culture"].Value" == "@ConstValues.Language.En") ? 450 : 300),
			idField: "id",
			textField: "name",
			multiple: true,
			editable: false,
			required: true,
			columns: [[
				{ field: "chk", align: "center", checkbox: true },
				{ field: "name", title: "@Resources.Career", width: (("@Request.Cookies["_culture"].Value" == "@ConstValues.Language.En") ? 400 : 250) },
			]],
		});

		$("#ddlOcisCode").combogrid({
			url: "@Url.Action(nameof(UtilityController.GetOCIS), nameof(UtilityController).GetControllerName())?conferenceId=0",
			panelWidth: 510,
			panelHeight: 300,
			idField: "id",
			textField: "name",
			multiple: true,
			editable: false,
			required: true,
			columns: [[
				{ field: "chk", align: "center", checkbox: true },
				{ field: "name", title: "@Resources.CheckAll" },
			]]
		});

		$("#detailWindow").window("open");
	}

	function editData(id) {
		var url = "@Url.Action(nameof(SysUserMasterController.GetEditData),
				nameof(SysUserMasterController).GetControllerName())" + "/" + id;
		$.get(url, null, function (data, textStatus, jqXHR) {
			if (data.result == "@ConstValues.AjaxFailResult") {
				common.showError(data.message);
				$("#dataGrid").datagrid("reload");
			} else {
				$("#hdnWindowType").val("edit");
				$("#detailWindowTitle").text("@Resources.Modify");
				$("#hidID").val(id);
				$("#ddlLock").combobox("setValue", data.data.isLocked);
				$("#ddlStatus").combobox("setValue", data.data.status);
				$("#txtSort").textbox("setValue", data.data.sort);
				$("#txtRemark").textbox("setValue", data.data.remark);

				$("#txtUserName").textbox("disable");
				$("#txtUserName").textbox("setValue", data.data.userName);
				$("#txtMail").textbox("disable");
				$("#txtMail").textbox("setValue", data.data.mail);
				$("#ddlLanguage").combobox("setValue", data.data.language);
				$("#txtFullName").textbox("setValue", data.data.fullName);
				$("#txtFullNameEN").textbox("setValue", data.data.fullNameEN);
				$("#txtFamilyName").textbox("setValue", data.data.familyName);
				$("#txtFamilyNameEN").textbox("setValue", data.data.familyNameEN);
				$("#txtFirstName").textbox("setValue", data.data.firstName);
				$("#txtFirstNameEN").textbox("setValue", data.data.firstNameEN);
				$("#ddlGender").combobox("setValue", data.data.gender ? "@ConstValues.Gender.男" : "@ConstValues.Gender.女");
				$("#dateBirthday").datebox("setValue", data.data.birthday);
				$("#txtCV").textbox("setValue", data.data.cv);
				$("#txtCVEN").textbox("setValue", data.data.cven);
				$("#txtAffiliation").textbox("setValue", data.data.affiliation);
				$("#txtAffiliationEN").textbox("setValue", data.data.affiliationEN);
				$("#txtDepartment").textbox("setValue", data.data.department);
				$("#txtDepartmentEN").textbox("setValue", data.data.departmentEN);
				$("#txtAddress").textbox("setValue", data.data.address);
				$("#txtAddressEN").textbox("setValue", data.data.addressEN);
				$("#txtZipCode").textbox("setValue", data.data.zipCode);
				$("#txtMobile").textbox("setValue", data.data.mobile);
				$("#txtTelephone").textbox("setValue", data.data.telephone);

				$("#txtInvoiceTitle").combobox("setValue", data.data.invoiceTitle);
				$("#txtInvoiceTitle").combobox("setText", data.data.invoiceTitle);
				$("#txtTaxNum").textbox("setValue", data.data.taxNum);
				$("#txtAddressAndTel").textbox("setValue", data.data.addressAndTel);
				$("#txtBank").textbox("setValue", data.data.bank);
				$("#txtBankAccount").textbox("setValue", data.data.bankAccount);

				$("#ddlCall").combobox({
					url: "@Url.Action(nameof(UtilityController.GetCallEn), nameof(UtilityController).GetControllerName())",
					valueField: "id",
					textField: "name",
					required: true,
					editable: false,
					panelHeight: "auto",
					onBeforeLoad: function (param) {
						param.language = "@ConstValues.Language.Cn";
					}
				});
				$("#ddlCall").combobox("setValue", data.data.call);

				$("#ddlCallEN").combobox({
					url: "@Url.Action(nameof(UtilityController.GetCallEn), nameof(UtilityController).GetControllerName())",
					valueField: "id",
					textField: "name",
					required: true,
					editable: false,
					panelHeight: "auto",
					onBeforeLoad: function (param) {
						param.language = "@ConstValues.Language.En";
					}
				});
				$("#ddlCallEN").combobox("setValue", data.data.callEN);

				$("#ddlDegree").combobox({
					url: "@Url.Action(nameof(UtilityController.GetDegree), nameof(UtilityController).GetControllerName())",
					valueField: "id",
					textField: "name",
					required: true,
					editable: false,
					panelHeight: "auto",
				});
				$("#ddlDegree").combobox("setValue", data.data.degree);

				$("#ddlCareer").combogrid({
					url: "@Url.Action(nameof(UtilityController.GetCareer), nameof(UtilityController).GetControllerName())",
					panelWidth: (("@Request.Cookies["_culture"].Value" == "@ConstValues.Language.En") ? 450 : 300),
					idField: "id",
					textField: "name",
					multiple: true,
					editable: false,
					required: true,
					columns: [[
						{ field: "chk", align: "center", checkbox: true },
						{ field: "name", title: "@Resources.Career", width: (("@Request.Cookies["_culture"].Value" == "@ConstValues.Language.En") ? 400 : 250) },
					]],
				});
				$("#ddlCareer").combogrid("setValues", data.data.career);

				$("#ddlOcisCode").combogrid({
					url: "@Url.Action(nameof(UtilityController.GetOCIS), nameof(UtilityController).GetControllerName())?conferenceId=0",
					panelWidth: 510,
					panelHeight: 300,
					idField: "id",
					textField: "name",
					multiple:true,
					editable:false,
					required: true,
					columns: [[
						{ field: "chk", align: "center", checkbox: true },
						{ field: "name", title: "@Resources.MajorField" },
					]],
					onLoadSuccess: function () {
					},
				});
				$("#ddlOcisCode").combogrid("setValues", data.data.ocisCode);

				$("#ddlCountry").combobox({
					url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
					valueField: "id",
					textField: "name",
					required: true,
				});
				$("#ddlCountry").combobox("setValue", data.data.country);
				$("#txtState").textbox("setValue", data.data.state);
				$("#txtCity").textbox("setValue", data.data.city);

				$("#detailWindow").window("open");
			}
		});
	}

	function saveData() {
		$.messager.confirm("@Resources.Save", "@Resources.CfmSave", function (r) {
			if (r) {
				var loading = layer.load(0,  {
					shade: [0.4,"#fff"]
				});

				$("#frmDetail").form({
					iframe: false,
					success: function (data) { }
				});

				switch ($("#hdnWindowType").val())
				{
					case "add":
						$("#frmDetail").form("submit", {
							url:"@Url.Action(nameof(SysUserMasterController.Create), nameof(SysUserMasterController).GetControllerName())",
							onSubmit: function (param) {
								param.random = Math.random();
							},
							success: function (data) {
								layer.close(loading);
								data = JSON.parse(data);
								if (data.result == "@ConstValues.AjaxFailResult") {
									common.showError(data.message);
								} else {
									common.showSuccess(data.message, true);
									$("#detailWindow").window("close");
									$("#dataGrid").datagrid("reload");
								}
							},
						});
						break;
					case "edit":
						$("#frmDetail").form("submit", {
							url:"@Url.Action(nameof(SysUserMasterController.Modify), nameof(SysUserMasterController).GetControllerName())",
							onSubmit: function (param) {
								param.random = Math.random();
							},
							success: function (data) {
								layer.close(loading);
								data = JSON.parse(data);
								if (data.result == "@ConstValues.AjaxFailResult") {
									common.showError(data.message);
								} else {
									common.showSuccess(data.message, true);
									$("#detailWindow").window("close");
									$("#dataGrid").datagrid("reload");
								}
							},
						});
						break;
				}
			}
		})
	};

	function roleData(id, roleName) {
		$("#hidUserId").val(id);
		$("#actionGrid").datagrid({
			url: "@Url.Action(nameof(SysUserMasterController.GetRoleData),
					nameof(SysUserMasterController).GetControllerName())",
			method: "get",
			fitColumns: true,
			height: 478,
			nowrap: false,
			pageSize: @ConstValues.DefaultGridRows,
			striped: true,
			toolbar: "#actionToolBar",
			columns: [[
				{
					field: "roleName", title: "@Resources.Operate", align: "center", width: 150,
					formatter: function(value, rec) {
						var strInfo = "";
						var tmp = rec.roleName == null ? "" : rec.roleName.replace(new RegExp("'",'g'),"’").replace(new RegExp('"','g'),"“");
						strInfo += "<a href='#' style='color:#DC143C;font-weight:bold;text-decoration:underline;' onclick='deleteRoleData(\""
								+ rec.id + "\",\"" + tmp + "\")'>@Resources.Delete【" + tmp + "】</a>";
						return strInfo;
					}
				},
				{ field: "userName", title: "@Resources.UserName", align: "center",  width: 150 },
				{ field: "actionName", title: "@Resources.ActionName", align: "center", width: 150},
			]],
			onBeforeLoad: function(param) {
				param.userId = $("#hidUserId").val();
				param.random = Math.random();
			},
			onLoadSuccess: function (data) {
				$(this).datagrid("autoMergeCells", ["roleName"]);
			}
		});
		$("#tRoleName").textbox("setValue", roleName);

		var orgCount = 0;
		$("#ddlAction").combobox({
			editable: false,
			required: true,
			valueField: "id",
			textField: "actionName",
			url: "@Url.Action(nameof(SysUserMasterController.GetRole),
					nameof(SysUserMasterController).GetControllerName())",
			onLoadSuccess: function(data) {
				orgCount = data.length;
			},
			onShowPanel: function () {
				if (orgCount < 10) {
					$(this).combobox("panel").height("auto");
				} else {
					$(this).combobox("panel").height(200);
				}
			},
			onBeforeLoad: function(param) {
				param.groupId = $("#hidRoleId").val();
				param.random = Math.random();
			},
		});

		$("#actionWindow").window("open");
	}

	function saveActionData() {
		var isValid = $("#actionDetail").form("validate");

		if (isValid) {
			$.messager.confirm("@Resources.Save", "@Resources.CfmSave", function (r) {
				if (r) {
					var loading = layer.load(0,  {
						shade: [0.4,"#fff"]
					});
					$.post("@Url.Action(nameof(SysUserMasterController.CreateRole),
							nameof(SysUserMasterController).GetControllerName())",
						$("#actionDetail").serialize(),
						function(data, textStatus, jqXHR) {
							layer.close(loading);
							if (data.result == "@ConstValues.AjaxFailResult") {
								common.showError(data.message);
							} else {
								common.showSuccess(data.message, true);
								$("#actionGrid").datagrid("reload");
								$("#dataGrid").datagrid("reload");
							}
						}
					);
				}
			});
		}
	}

	function groupData(id, roleName) {
		$("#groUserId").val(id);

		$("#groupGrid").datagrid({
			url: "@Url.Action(nameof(SysUserMasterController.GetGroupData),
					nameof(SysUserMasterController).GetControllerName())",
			method: "get",
			fitColumns: true,
			height: 478,
			nowrap: false,
			pageSize: @ConstValues.DefaultGridRows,
			striped: true,
			toolbar: "#actionToolBar",
			columns: [[
				{
					field: "groupName", title: "@Resources.Operate", align: "center", width: 150,
					formatter: function(value, rec) {
						var strInfo = "";
						var tmp = rec.groupName == null ? "" : rec.groupName.replace(new RegExp("'",'g'),"’").replace(new RegExp('"','g'),"“");
						strInfo += "<a href='#' style='color:#DC143C;font-weight:bold;text-decoration:underline;' onclick='deleteGroupData(\""
								+ rec.id + "\",\"" + tmp + "\")'>@Resources.Delete【" + tmp + "】</a>";
						return strInfo;
					}
				},
				{ field: "roleName", title: "@Resources.RoleName", align: "center",  width: 150 },
				{ field: "actionName", title: "@Resources.ActionName", align: "center", width: 150},
			]],
			onBeforeLoad: function(param) {
				param.userIdGro = $("#groUserId").val();
				param.random = Math.random();
			},
			onLoadSuccess: function (data) {
				$(this).datagrid("autoMergeCells", ["groupName"]);
			}
		});
		$("#groRoleName").textbox("setValue", roleName);

		var orgCount = 0;
		$("#ddlGroup").combobox({
			editable: false,
			required: true,
			valueField: "id",
			textField: "actionName",
			url: "@Url.Action(nameof(SysUserMasterController.GetGroup),
					nameof(SysUserMasterController).GetControllerName())",
			onLoadSuccess: function(data) {
				orgCount = data.length;
			},
			onShowPanel: function () {
				if (orgCount < 10) {
					$(this).combobox("panel").height("auto");
				} else {
					$(this).combobox("panel").height(200);
				}
			},
			onBeforeLoad: function(param) {
				param.random = Math.random();
			},
		});
		$("#groupWindow").window("open");
	}

	function saveGroupData() {
		var isValid = $("#groupDetail").form("validate");
		if (isValid) {
			$.messager.confirm("@Resources.Save", "@Resources.CfmSave", function (r) {
				if (r) {
					var loading = layer.load(0,  {
						shade: [0.4,"#fff"]
					});
					$.post("@Url.Action(nameof(SysUserMasterController.CreateGroup),
							nameof(SysUserMasterController).GetControllerName())",
						$("#groupDetail").serialize(),
						function(data, textStatus, jqXHR) {
							layer.close(loading);
							if (data.result == "@ConstValues.AjaxFailResult") {
								common.showError(data.message);
							} else {
								common.showSuccess(data.message, true);
								$("#groupGrid").datagrid("reload");
								$("#dataGrid").datagrid("reload");
							}
						}
					);
				}
			});
		}
	}

	function deleteRoleData(id, name) {
		var confirmMessage = "@Resources.CfmDelete";
		confirmMessage = confirmMessage.replace(/\{0\}/g, name);
		$.messager.confirm("@Resources.Delete", confirmMessage, function (r) {
			if (r) {
				$("#hidRoleID").val(id);
				$.post("@Url.Action(nameof(SysUserMasterController.DeleteRole),
						nameof(SysUserMasterController).GetControllerName())",
					$("#actionDetail").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
							$("#actionGrid").datagrid("reload");
							$("#dataGrid").datagrid("reload");
						}
					}
				);
			}
		});
	}

	function deleteGroupData(id, name) {
		var confirmMessage = "@Resources.CfmDelete";
		confirmMessage = confirmMessage.replace(/\{0\}/g, name);
		$.messager.confirm("@Resources.Delete", confirmMessage, function (r) {
			if (r) {
				$("#hidGroupID").val(id);
				$.post("@Url.Action(nameof(SysUserMasterController.DeleteGroup),
						nameof(SysUserMasterController).GetControllerName())",
					$("#groupDetail").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
							$("#groupGrid").datagrid("reload");
							$("#dataGrid").datagrid("reload");
						}
					}
				);
			}
		});
	}

	function downloadImportTemplate() {
		var url = "@Url.Action(nameof(SysUserMasterController.DownloadImportTemplate),
				nameof(SysUserMasterController).GetControllerName())";
		$("#iframeDownload").attr("src", url);
	}

	function openImport() {
		$("#importWindow").window("open");
	}

	function importData() {
		var loading = layer.load(0,  {
			shade: [0.4,"#fff"]
		});

		$("#frmImport").form({
			iframe: false,
			success: function (data) { }
		});

		$("#frmImport").form("submit", {
			url: "@Url.Action(nameof(SysUserMasterController.Import), nameof(SysUserMasterController).GetControllerName())",
			onSubmit: function (param) {
				param.random = Math.random();
			},
			success: function (data) {
				layer.close(loading);
				data = JSON.parse(data);
				if (data.result == "@ConstValues.AjaxFailResult") {
					common.showError(data.message);
					$("#dataGrid").datagrid("reload");
				} else {
					common.showSuccess(data.message, true);
					$("#importWindow").window("close");
					$("#dataGrid").datagrid("reload");
				}
			}
		});
	}

	function exportData() {
		var exportIdList = $("#hdnIds").val();
		if (exportIdList == "") {
			$.messager.alert("@Resources.Export", "@Resources.MsgRecordMust", "warning");
			return;
		}
		$("#frmExport").submit();
	}
</script>
}